package com.victor.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.victor.dao.JmAuditDao;
import com.victor.entity.JMInfo;
import com.victor.service.JmAuditService;


@Service
public class JmAuditServiceImpl implements JmAuditService{
	
	@Autowired
	private JmAuditDao jmAuditDao;
	
	/**
	 * 	根据状态查询列表 (分页)
	 */
	@Override
	public PageInfo<JMInfo> selectAll(String status,int page,int row) {
		PageHelper.startPage(page, row);
		List<JMInfo> list = jmAuditDao.selectAll(status);
		return new PageInfo<>(list, 5);
	}
	
	/**
	 * 	根据状态查询所有入驻列表
	 */
	@Override
	public List<JMInfo> selectAllByStatus(String status) {
		return jmAuditDao.selectAll(status);
	}

	/**
	 * 审批通过
	 */
	@Override
	public boolean pass(Integer id) {
		
		return jmAuditDao.pass(id);
	}
	
	/**
	 * 审批不通过
	 */
	@Override
	public boolean noPass(Integer id) {
		
		return jmAuditDao.noPass(id);
	}

	/**
	 *	 批量删除
	 */
	@Override
	public boolean batchDelete(int[] ids) {
		return jmAuditDao.batchDelete(ids) > 0 ? true : false;
	}

	/**
	 * 详情页面
	 */
	@Override
	public JMInfo selectById(Integer id) {
		return jmAuditDao.selectById(id);
	}

	/**
	 * 	模糊查询入驻商家列表
	 */
	@Override
	public List<JMInfo> likeSearch(String search) {
		return jmAuditDao.likeSearch(search);
	}

}
